/*
 * @Author: zzd993
 * @Date: 2023-05-18 20:54:46
 * @LastEditors: zzd993
 * @LastEditTime: 2023-06-05 22:01:27
 * @FilePath: \硅谷甄选vue3+ts+vite+echarts+pinia\src\components\index.ts
 * Copyright (c) 2023 by ZZD, All Rights Reserved.
 */
import SvgIcon from './SvgIcon/index.vue'
import type { App, Component } from 'vue'
//引入element-plus提供全部图标组件
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// 全局对象
const allGlobalComponent: {
  [name: string]: Component
} = { SvgIcon }

// 对外暴露一个插件对象
export default {
  install(app: App) {
    Object.keys(allGlobalComponent).forEach((key) => {
      // 注册为全局组件
      app.component(key, allGlobalComponent[key])
    })
    //将element-plus提供图标注册为全局组件
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component)
    }
  },
}
